var basisMapNameData = [
	"日初库存量",
	"实际到货量",
	"实际需求量",
	"销售订单需求量",
	"预测需求量",
	"安全库存量",
	"未结订单预计到货",
	"建议订单预计到货",
	"库存价值",
	"30天年化周转率",
	"本年周转率",
	"需求满足率",
	"预计OPO未提数量"
];
function tofixeds(data,num){
	if(num!=""||typeof num != "undefined"){
		num = 2;
	}
	if(String(data).indexOf(".")>-1){
		return data.toFixed(num);
	}else{
		return data;
	}
};
var tpls = {
    forecastMap0:{
        tooltip: {
            trigger: 'axis',
            textStyle:{
            	align:"left"	
            },
            formatter: function(params){
				var showData = "";
            	for(var i=0;i<params.length;i++) 
            	{
            		if(i!=params.length-1){
            			showData = showData + params[i].seriesName + ":" + params[i].value +  "<br />";	
            		}else{
            			showData = showData + params[i].seriesName + ":" + params[i].value ;
            		}
            	}
            	return showData;
            }
        },
        legend: {
            left: 'center',
            data: ['销售订单', '销售预测','模型预测']
        },
        xAxis: {
            type: 'category',
            name: '',
            splitLine: {show: false},
            data: ['一', '二', '三', '四', '五', '六', '七', '八', '九']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        yAxis: {
            type: 'value',
            name: '数量'
        },
        series: [
            {
                name: '销售订单',
                type: 'line',
                data: [1, 3, 9, 27, 81, 247, 741, 2223, 6669]
            },
            {
                name: '销售预测',
                type: 'line',
                data: [1, 2, 4, 8, 16, 32, 64, 128, 256]
            },
            {
                name: '模型预测',
                type: 'line',
                data: [1/2, 1/4, 1/8, 1/16, 1/32, 1/64, 1/128, 1/256, 1/512]
            }
        ]
    },
    basisMap0:{
    	legend: {
            data:basisMapNameData,
            width:"70%",
            itemGap:20
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                crossStyle: {
                    color: '#999'
                }
            },
            textStyle:{
            	align:"left"
            },
            formatter:function(params){
            	var showData =  "时间:" + 
            					params[0].axisValue.split("/")[0] + "年" +
            					params[0].axisValue.split("/")[1] + "月" +
            					params[0].axisValue.split("/")[2] + "日" + "<br />";
            	for(var i=0;i<params.length;i++){
            		if(params[i].data != null){
            			if(params[i].seriesName.indexOf("率")>-1 && params[i].seriesName.indexOf("周转率")==-1){
            				showData += params[i].seriesName + ":" + tofixeds(params[i].data) + "%" + "<br />";		
            			}else{
            				showData += params[i].seriesName + ":" + tofixeds(params[i].data) + "<br />";		
            			}
            			
            		}
            	}
            	return showData;
            }
        },
        grid: {
            left: '2%',
            right: '2%',
            bottom: '10%',
            top:"18%",
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                data: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
                axisPointer: {
                    type: 'shadow'
                }
            }
        ],
        yAxis: [
            {
                type: 'value',
               	splitLine:{
                	show:false	
                },
                axisLabel: {
                    formatter: '{value} '
                }
            },
            {
                type: 'value',
                splitLine:{
                	show:false	
                },
                axisLabel:{
                    formatter: '{value}% '
                }
            },
            {
                type: 'value',
                show:false,
                splitLine:{
                	show:false	
                },
                axisLabel:{
                    formatter: '{value}% '
                }
            }
        ],
        dataZoom:[
        	{
        		type:"inside",
        		start:25,
        		end:75
       		},
       		{
       			type:"slider",
       			textStyle:{
       				height:10
       			}
       		}
       	],
        series: [
            {
                name:basisMapNameData[0],
                type:'bar',
                stack: '广告',
                itemStyle:{
                	normal:{
                		color:"#555555"
                	}
                },
                barWidth:"20%",
                data:[76.7, 105.6, 62.2, 32.6, 20.0, 6.4, 83.3]
            },
            {
                name:basisMapNameData[1],
                type:'bar',
                stack: '广告',
                itemStyle:{
                	normal:{
                		color:"#F8B33C"
                	}
                },
                barWidth:"20%",
                data:[70.7, 75.6, 82.2, 48.7, 18.8, 6.0,82.3]
            },
            {
                name:basisMapNameData[2],
                type:'line',
                smooth:true,
                data:[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 17]
            },
            {
                name:basisMapNameData[3],
                type:'line',
                smooth:true,
                data:["","","","","","",17,20.3, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3]
            },
            {
                name:basisMapNameData[4],
                type:'line',
                smooth:true,
                data:[2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 17]
            },
            {
                name:basisMapNameData[5],
                type:'line',
                smooth:true,
                data:["","","","","","",17,20.3, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3]
            },
            {
                name:basisMapNameData[6],
                type:'line',
                smooth:true,
                data:[5.0, 5.2, 6.3, 7.5, 9.3, 13.2, 20]
            },
            {
                name:basisMapNameData[7],
                type:'line',
                smooth:true,
                data:["","","","","","",20,23.3, 5.2, 8.3, 7.5, 9.3, 13.2, 23.3]
            },
            {
                name:basisMapNameData[8],
                type:'line',
                yAxisIndex: 2,
                smooth:true,
                data:[7.0, 8.2, 8.3, 9.5, 11.7, 15.2, 18]
            },
            {
                name:basisMapNameData[9],
                type:'line',
                yAxisIndex: 1,
                smooth:true,
                data:["","","","","","",18,16.6, 9.2, 5.3, 9.5, 3.3, 10.2, 15.3]
            },
            {
                name:basisMapNameData[10],
                type:'line',
                yAxisIndex: 1,
                smooth:true,
                data:[15.0, 15.2, 16.3, 17.5, 19.3, 2.2, 10]
            },
            {
                name:basisMapNameData[11],
                type:'line',
                yAxisIndex: 1,
                smooth:true,
                data:["","","","","","",10,3.3, 2.2, 1.3, 17.5, 19.3, 10.2, 13.3]
            },
            {
                name:basisMapNameData[12],
                type:'line',
//              lineStyle:{
//              	normal:{
//              		width:2,
//              		color:"#C3E8F1"
//              	}
//              },
                smooth:true,
                data:["","","","","","",10,3.3, 2.2, 1.3, 17.5, 19.3, 10.2, 13.3]
            }
        ]
    }
}
export default tpls;
